package com.kefu.call.vo;

import javax.persistence.Id;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;

import com.kefu.call.model.ActivityInventoryInfo;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractUpdateVo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * @author francis
 * @date 2021/05/22
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "活动清单")
public class ActivityInventoryInfoUpdateVo extends AbstractUpdateVo<ActivityInventoryInfo,String> {


	@NotEmpty
    @ApiModelProperty(value = "主键")
    private String inventoryId;
    @Size(max = 32)
    @ApiModelProperty(value = "活动ID")
    private String activityId;
    @Size(max = 50)
    @ApiModelProperty(value = "清单名称")
    private String inventoryName;
    @ApiModelProperty(value = "数据状态0 无效，1有效",hidden=true)
    private Integer dataStatus=1;
    @Size(max = 32)
    @ApiModelProperty(value = "所属用户")
    private String userId;
    @Size(max = 32)
    @ApiModelProperty(value = "所属用户")
    private String userName;
    @ApiModelProperty(value = "清单状态",example="1",allowableValues="1,2,3,4，5，6",notes="1 未分配，2已分配，3处理中，4预约，5处理完成，6 处理失败")
    private Integer inventoryStatus;
    @Size(max = 32)
    @ApiModelProperty(value = "客户ID")
    private String customerId;
    @Size(max = 32)
    @ApiModelProperty(value = "客户名称")
    private String customerName;
	@ApiModelProperty(value = "客户号码")
	private String customerPhone;
    @ApiModelProperty(value = "预约时间")
    private Long reserveTime;
    @Size(max = 32)
    @ApiModelProperty(value = "联系计划ID")
    private String planId;

    @Override
    public ActivityInventoryInfo convert() {
        ActivityInventoryInfo info = new ActivityInventoryInfo();
        info.setActivityId(activityId);
        info.setInventoryName(inventoryName);
        info.setDataStatus(dataStatus);
        info.setUserId(userId);
        info.setUserId(userName);
        info.setInventoryStatus(inventoryStatus);
        info.setCustomerId(customerId);
        info.setCustomerName(customerName);
        info.setReserveTime(reserveTime);
        info.setPlanId(planId);
        KefuContext context = KefuContext.getKefuContext();
        info.setInventoryId(inventoryId);
        info.setUpdateTime(context.getNow());
        info.setUpdateUser(context.getUserId());
        return info;
	}
}